package com.zcf.controller;

import com.zcf.common.json.Body;
import com.zcf.pojo.Withdraw;
import com.zcf.service.WithdrawServiceImpl;
import com.zcf.utils.rsa.RSADecodeUtils;
import com.zcf.vo.out.LayuiJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author jj
 * @date 2019/11/22 15:48
 */
@CrossOrigin(origins = "*", maxAge = 3600)
@Controller
@RequestMapping("/withdraw")
public class WithdrawController {
    @Autowired
    WithdrawServiceImpl withdrawService;
    /**
    * @description :提现
    * @param content
    * @date : 2019/11/22 16:03
    * @author : jj
    */
    @PostMapping("add")
    @ResponseBody
    public Body add(String content){
        Withdraw withdraw=RSADecodeUtils.decode(content,Withdraw.class);
        System.out.println(withdraw);
        return withdrawService.add(withdraw);
    }
    /**
    * @description :查询未审批的列表
    * @date : 2019/11/29 11:07
    * @author : jj
    */
    @PostMapping("list" )
    @ResponseBody
    public LayuiJson findList(@RequestParam(value = "pageNum") int pageNum,
                              @RequestParam(value = "pageSize") int pageSize,int type){
        return  withdrawService.fandList(pageNum,pageSize,type);
    }
    /**
     * @description :查询未审批的列表
     * @date : 2019/11/29 11:07
     * @author : jj
     */
    @PostMapping("findAlllist" )
    @ResponseBody
    public LayuiJson findAlllist(@RequestParam(value = "pageNum") int pageNum,
                              @RequestParam(value = "pageSize") int pageSize){
        return  withdrawService.fandAllList(pageNum,pageSize);
    }

    /**
     * @description :查询未审批的列表
     * @date : 2019/11/29 11:07
     * @author : jj
     */
    @PostMapping("update" )
    @ResponseBody
    public Body update(Withdraw withdraw){
        return  withdrawService.update(withdraw);
    }
}
